#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    bool CheckPermutation(string s1, string s2) {
        if (s1.size() != s2.size()) return false;
        int hash[26] = { 0 };
        for (char ch : s1)
        {
            hash[ch - 'a']++;
        }
        for (char ch : s2)
        {
            hash[ch - 'a']--;
            if (hash[ch - 'a'] < 0) return false;
        }

        for (int i = 0; i < 26; i++)
        {
            if (hash[i]) return false;
        }
        return true;
    }
};